﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Security.Cryptography;
using System.Collections.Specialized;
using System.IO;
using System.Data.SqlClient;
using System.Net;

public partial class OnlinePay_Alipay_Default : PageBase
{
    public string PayFormalitiesFeesScale = "";
    public string Balance = "";
    public string Remark = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        double OnlinePay_Alipay_PayFormalitiesFeesScale = PublicFunction.GetOptionsAsDouble("OnlinePay_Alipay_PayFormalitiesFeesScale", 0);

        PayFormalitiesFeesScale = (OnlinePay_Alipay_PayFormalitiesFeesScale > 0 ? OnlinePay_Alipay_PayFormalitiesFeesScale.ToString() + "%" : "0") ;

        Balance = _User.Balance.ToString("N");

        bool OnlinePay_Alipay_Status_ON = PublicFunction.GetOptionsAsBoolean("OnlinePay_Alipay_Status_ON", false);

        if (!OnlinePay_Alipay_Status_ON)
        {
            PublicFunction.GoError(ErrorNumber.Unknow, "未启用此功能", this.GetType().BaseType.FullName);

            return;
        }

        double Price = ShoveEL._Convert.StrToDouble(ShoveEL._Web.Utility.GetRequest("Price"), 0);

        if (Price == 0)
        {
            //计算应充金额
            if (_User.isActivation == false)
            {
                if (_User.UserType == 1)
                {
                    PayMoney.Value = PublicFunction.GetOptionsAsString("每单价格");
                }
                else if (_User.UserType == 3)
                {
                    PayMoney.Value = PublicFunction.GetOptionsAsString("3单价格");
                }
                else if (_User.UserType == 5)
                {
                    PayMoney.Value = PublicFunction.GetOptionsAsString("5单价格");
                }
                else if (_User.UserType == 10)
                {
                    PayMoney.Value = PublicFunction.GetOptionsAsString("10单价格");
                }
            }

            Remark = "您还未激活，激活自己需充值：" + PayMoney.Value + "元";
        }
        else
        {
            PayMoney.Value = Price.ToString();

            Remark = "您的可用余额不足，购买该商品需充值：" + PayMoney.Value + "元";
        }
    }

    #region Web 窗体设计器生成的代码

    override protected void OnInit(EventArgs e)
    {
        isRequestLogin = true;
        SecondLevelPassword = true;
        RequestLoginPage = "BalanceCenter/../OnlinePay/Alipay/Default.aspx";

        base.OnInit(e);
    }

    #endregion

}